package GUI;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.*;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class AddIorP extends JFrame {

	private JPanel contentPane;
	private HowMany hm;

	/**
	 * Create the frame.
	 */
	public AddIorP(String s) {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 385, 310);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JTextField txtSearch = new JTextField();
		txtSearch.setText("search...");
		txtSearch.setBounds(10, 10, 140, 20);
		contentPane.add(txtSearch);
		txtSearch.setColumns(10);
		
		JButton btnSearch = new JButton("Search");
		btnSearch.setBounds(160, 9, 89, 23);
		contentPane.add(btnSearch);
		
		JButton btnAdd = new JButton(">>");
		btnAdd.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				hm = new HowMany(true);
				hm.setVisible(true);
			}
		});
		btnAdd.setBounds(160, 69, 50, 23);
		contentPane.add(btnAdd);
		
		JButton btnRemove = new JButton("<<");
		btnRemove.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				hm = new HowMany(false);
				hm.setVisible(true);
			}
		});
		btnRemove.setBounds(160, 103, 50, 23);
		contentPane.add(btnRemove);
		
		JList list = new JList();
		list.setBounds(10, 41, 140, 190);
		contentPane.add(list);
		
		JList list_1 = new JList();
		list_1.setBounds(220, 41, 140, 190);
		contentPane.add(list_1);
		
		JButton btnCancel = new JButton("Cancel");
		btnCancel.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				dispose();
			}
		});
		btnCancel.setBounds(10, 242, 89, 23);
		contentPane.add(btnCancel);
		
		JButton btnSave = new JButton("Save");
		btnSave.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				//add the items/products!!!!
				dispose();
			}
		});
		btnSave.setBounds(271, 242, 89, 23);
		contentPane.add(btnSave);
		
		String x = "item";
		if(x.equals(s)){setTitle("Add Item");}else{setTitle("Add Product");}
	}

}
